-- This button allows people to create hideable notes on any card.
-- The note consists of a text field and a small button which hides
-- the field if it is visible and shows it if it is not.
-- The code includes an interesting function which returns a
-- script for the hide-it button.
-- Feel free to place this button or a variant on all stacks. Please
-- include notice that the original version of the button was written
-- by Mark Igra, 1588 Henry St. #2. Berkeley, CA 94709.
-- Copyright Mark Igra.
on mouseUp
put the number of card fields + 1 into fieldNum
put the userLevel into saveLevel
set the userLevel to 5
if the userLevel < 5 then
answer "Can't make new fields now" with "OK"
exit mouseUp
end if
-- You will probably want to take this notice out
answer "Click where you want the note" with "Cancel" or "OK"
if it is "Cancel" then exit mouseUp
wait until the mouseClick
put the mouseLoc into noteLoc
set the cursor to 4 -- watch
set lockScreen to true
-- Create the field
choose field tool
drag from noteLoc to item 1 of noteLoc + 150,item 2 of noteLoc + 150 with commandKey
set the style of card field fieldNum to shadow
put the id of card field fieldNum into fieldID
-- Make the button
makeButton noteLoc,fieldID
-- Return everything to normal.
choose browse tool
set the userLevel to saveLevel
set the cursor to saveCursor
set lockScreen to false
end mouseUp
on makeButton noteLoc,fieldID
put the number of buttons + 1 into buttonNum
choose button tool
drag from noteLoc to item 1 of noteLoc + 11,item 2 of noteLoc + 11 with commandKey
set the style of button buttonNum to rectangle
set the rect of button buttonNum to item 1 of noteLoc, item 2 of noteLoc, item 1 of noteLoc + 6, item 2 of noteLoc + 6
set the script of button buttonNum to PostItScript(fieldID)
end makeButton
-- The buttons that hide and show a post it note have a script
-- which is customized for the note they show. The button's script
-- uses the id of the field so that it will work no matter how the
-- fields are shuffled.
function PostItScript fieldID
return "on mouseUp" & return¬ -- Note the use of 'return' as end of line
&& "Set the visible of card field id" && fieldID && "to not the visible of card field id" && fieldID & return & "end mouseUp"
end PostItScript
-- part 7 (field)
-- low flags: 80
-- high flags: 0004
-- rect: left=315 top=242 right=343 bottom=466
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 8 (button)
-- low flags: 00
-- high flags: 0002
-- rect: left=315 top=242 right=248 bottom=321
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on mouseUp
Set the visible of card field id 7 to not the visible of card field id 7
end mouseUp
-- part contents for background part 1
----- text -----
I sort of gave up on Hypercard for a while, feeling that it imposed a sense of order on my work habits that was counter-productive. I didn't want to learn how to behave like Hypercard. I wanted it to behave like me.
Danny Goodman's and Dan Shafer's books rekindled my interest and imparted an understanding that I could make Hypercard behave like me.
I began fiddling around with my Home stack and looking at other peoples stacks and ideas. I had come across Mark Igra's "Post-its" button, liked it, but knew it wouldn't work for my daily scribblings. Too neat. Too hidden.
I thought, "if the button was bigger and had a name, it would remind me of what is in the note.
-- part contents for card part 7
----- text -----
Don't get me wrong. This is a great little tool for providing a bit more info or depth. It just isn't handy for notes that you want to bug you and that you will throw away.